package com.PAT.UnSatisfying;

import java.net.SecureCacheResponse;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/02/10/0:16
 * @Description:
 * @Target: 差10
 */
public class 月饼 {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String ss1 = in.nextLine();
        String[] s = ss1.split(" ");
        int targetNum = Integer.valueOf(s[1]);
        MoonCake[] moonCakes = new MoonCake[Integer.valueOf(s[0])];
        int[] Nums = new int[Integer.valueOf(s[0])];
        int[] Prices = new int[Integer.valueOf(s[0])];

        for (int i = 0; i < Nums.length; i++) {
            Nums[i] = in.nextInt();
        }

        for (int i = 0; i < Prices.length; i++) {
            Prices[i] = in.nextInt();
        }

        for (int i = 0; i < moonCakes.length; i++) {
            MoonCake moonCake = new MoonCake(Nums[i],Prices[i]);
            moonCakes[i] = moonCake;
        }

        Arrays.sort(moonCakes,new MoonCakeCompare());

       /* for (MoonCake moonCake : moonCakes) {
            System.out.println(moonCake.getNum()+" "+ moonCake.getPrice() + " "+ moonCake.getAvg());
        }*/
        double sumPrice = 0.00;
            for (int i = 0; i < moonCakes.length; i++) {
                if (targetNum>moonCakes[i].getNum()){
                    targetNum-=moonCakes[i].getNum();
                    sumPrice+=moonCakes[i].getPrice();
                }else {
                    sumPrice=sumPrice+(targetNum)*moonCakes[i].getAvg();
                    break;
                }
            }


        System.out.format("%.2f",sumPrice);



    }


    static class MoonCakeCompare implements Comparator<MoonCake>{
        @Override
        public int compare(MoonCake o1, MoonCake o2) {
            return -(int)((o1.getAvg()-o2.getAvg())*10000);
        }
    }


    static class MoonCake{
        private int Num;
        private int Price;
        private double Avg;

        public MoonCake() {
        }

        public MoonCake(int num, int price) {
            Num = num;
            Price = price;
        }

        public int getNum() {
            return Num;
        }

        public void setNum(int num) {
            Num = num;
        }

        public int getPrice() {
            return Price;
        }

        public void setPrice(int price) {
            Price = price;
        }

        public double getAvg() {
            return (double) this.getPrice()/this.getNum();
        }

        @Override
        public String toString() {
            return "MoonCake{" +
                    "Num=" + Num +
                    ", Price=" + Price +
                    ", Avg=" + Avg +
                    '}';
        }
    }
}
